package io;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 * 使用文件输入流从文件中读取数据
 */
public class FisDemo {
    public static void main(String[] args) throws IOException {

        /*FileInputStream fis = new FileInputStream("fos.txt");
        int r1 = fis.read();
        int r2 = fis.read();
        int r3 = fis.read();
        fis.close();
        System.out.println(r1);
        System.out.println(r2);
        System.out.println(r3);*/
        /*FileInputStream fis = new FileInputStream("./fos.txt");
        int f1 = fis.read();
        int f2 = fis.read();
        int f3 = fis.read();
        fis.close();
        System.out.println(f1);
        System.out.println(f2);
        System.out.println(f3);*/
        FileInputStream fis = new FileInputStream("./fos.txt");
        int flag;
        while((flag=fis.read())!=-1){
            //一次读取低8位
            System.out.println(flag);
        }
        fis.close();
    }
}
